Moves this object’s picture sideways by a different amount on every row, so it wobbles like something seen through water. look is one of the WARP_ constants, strength (1 to 3) is how far it moves, and speed is how fast the pattern travels down the picture. WARP_NONE turns it off.
Works differently on Game Boy - The Game Boy moves the two sprite pieces of a picture sideways by a different amount on every line; the picture can be 16 pixels wide and 16 tall at most, only one picture at a time is bent, and a line may show the line above's shift.
Works differently on Game Boy Color - The Game Boy Color moves the two sprite pieces of a picture sideways by a different amount on every line; the picture can be 16 pixels wide and 16 tall at most, only one picture at a time is bent, and a line may show the line above's shift.
Works differently on Sega Genesis - The Sega Genesis cannot move one row of a picture on its own, so it draws a warped picture as strips of 8 rows and moves each strip by the average of the look's pixels over its eight rows. WARP_WAVE and WARP_DRIFT look as they do on the Game Boy Advance, WARP_DRUNK and WARP_ZIGZAG a little softer, and WARP_SHAKE and WARP_SHIMMER weaker (a strip cannot shake row by row). The pattern belongs to the picture and moves back by speed rows a frame as on the Advance. A warped picture needs one sprite for every 8 rows (the console holds 80, 20 on a line), the game keeps a second copy of every picture it warps, and a strip that moves costs about 3,000 clocks. It works on the picture the game draws for an object with no Draw event.
On other consoles this differs: see Side by side and How the consoles differ.
sprite_warp(look, strength, speed)| Name | Type |
|---|---|
look | warp_look |
strength | int |
speed | real |
Nothing.
Moves an object's picture sideways by a different amount on every row, so it wobbles, sways, shakes or shimmers. A flag in the wind, a drunk, something under water, a car that has just been hit: it is the same trick each time. The picture is not turned or scaled, only slid along its rows.


A striped lighthouse stands in for the example's object, because a wobble is much easier to see on something tall with stripes. First the lighthouse straight, then each look at strength 2, standing still. Real pictures from a Game Boy Advance ROM.
You give it three things:
look - which warp. One of the WARP_ names (the list is just below). WARP_NONE turns the warp off.strength - a whole number from 1 to 3: how far the rows are moved. A number past that range is held to the nearest end.speed - how many rows the pattern travels down the picture every frame. 0 holds it still, a negative number sends it up, 0.25 is slow and 1 is quick. A look that has no pattern to move ignores it.It belongs to the object that calls it, so there is no handle to keep: write sprite_warp(WARP_WAVE, 2, 0.5) in the object's own event and it is the object's picture that wobbles. The pattern belongs to the picture, not to the screen: when the object moves, its wobble moves with it.
| Look | What it is | How far it moves a row at strength 1, 2 and 3 |
|---|---|---|
WARP_WAVE | a smooth wave, 32 rows from one bend to the next | 1, 2 and 4 pixels |
WARP_DRUNK | a slow, wide sway that never quite repeats | 1, 3 and 5 pixels |
WARP_SHAKE | every row jumps to its own side, like a hit | 1, 2 and 3 pixels |
WARP_ZIGZAG | straight lines that turn in sharp points | 2, 3 and 5 pixels |
WARP_SHIMMER | tiny quick ripples, like air over a hot road | 1, 2 and 3 pixels |
WARP_DRIFT | one long, lazy curve, like seaweed in a current | 2, 4 and 6 pixels |
sprite_warp changes the picture an object gets by itself: the sprite you chose for it, drawn at its place. That means an object with no Draw event. An object that draws itself with draw_sprite and its friends is not changed by it. For those, draw_sprite_ripple is the row-by-row call, and draw_sprite_3d bends a picture like a barrel.
A script or a room's creation code is not an object, so it has no picture of its own to warp. Calling it there stops a development build with a message that says so.
You do not need to call it every frame. Call it once, in the Create event, and the warp keeps going by itself. Calling it again with the same look and strength only changes the speed, so a Step event that asks every frame does not restart anything. Calling it with a different look or strength swaps the warp and keeps the pattern where it was.
If the object is hidden, or off the screen, its picture is let go of and the warp with it. The warp comes back with the picture. While the picture is gone the warp still holds its place in the line, so hiding something is not a way to free a slot. Use the next section.
sprite_warp(WARP_NONE, 0, 0);This gives the slot back straight away. The last two numbers are ignored, but they have to be there. When the object is destroyed, or its room ends, the warp ends by itself and its slot comes back with nothing for you to do.
Always destroy it, do not hide it. There is no way to hide a warp, on purpose: something hidden would look gone but would still be using up one of the console's few row-by-row slots, and then the next effect you ask for would not appear and nothing would tell you why.
A warp uses one of the 8 row-by-row effects the console has, for as long as the object has a picture on the screen, and no matrix. A room change keeps two of the eight for itself, so there are six left for you, shared with everything else that works row by row: draw_sprite_ripple, draw_text_3d, sprite_distort, background_look and a sky from screen_backdrop. You can see how many are in use on the debug screen: the line called H-BLANK.
The patterns live in the cartridge, not in memory, so a warp costs a few thousand bytes of the cartridge for the looks you use and almost no memory. It costs the console's time too, though not much: measured on a real ROM, about 1 hundredth of a frame while the pattern stands still (speed 0) and about 3 hundredths while it moves. Picking the look with a variable (sprite_warp(my_look, 2, 0)) is fine too, but it keeps the patterns of all six looks.
Ask for more than there is and the game does not skip it. A development build stops with a message that says how many slots there are and names every look that is holding one, so you know which one to turn off. A release build, which has no way to stop and show a message, shows the picture straight. It never half-works.
sprite_warp(WARP_WAVE, 2, 0.5);A picture that wobbles, the waves running down it. Call it in the object's Create event.
if (btn_pressed(BTN_A)) {
sprite_warp(WARP_SHAKE, 3, 2);
}
if (btn_pressed(BTN_B)) {
sprite_warp(WARP_NONE, 0, 0);
}Pressing A makes the picture buzz as if it had been hit. Pressing B turns it off. Pressing A again while it is already shaking changes nothing, because it is the same look and strength.
Costs ONE of the console’s 8 row-by-row (H-Blank) effects for as long as the object has a picture on the screen, and no matrix. A room change keeps two of the eight for itself, so six are left for you, shared with everything else that works row by row. The tables are in the cartridge, so the look costs a few thousand bytes of it and almost no memory. It works on the picture the engine draws for the object by itself, which means an object with no Draw event; an object that draws itself with draw_sprite is not changed by it (draw_sprite_ripple is the call for those). Call it from the object’s own event, once: the Create event is the place. Calling it again with the same look and strength only changes the speed. The look belongs to the object: when the object is destroyed, or its room ends, the look ends and its slot comes back with nothing for you to do. If the object is hidden, or off the screen, its picture is let go of and the effect with it; the look keeps its slot and the effect comes back with the picture. Turning it off with WARP_NONE hands the slot back at once, but hiding something does not: destroy it, do not hide it. If there is no room for another one, a development build stops with a message that names every look holding a slot; a release build shows the sprite straight. The in-game debug overlay shows the count as H-BLANK.